import request from '@/utils/http'; // 导入http中创建的axios实例
import qs from "qs"
const order = {
	//获取下单时间
	payOrderList(params){
		return request({
			url:'/order/delivery/time/list',
			method:"post"
		})
	},
	//保存订单信息
	payOrderAdd(params){
		return request({
			url:'/order/add',
			method:'post',
			data:params
		})
	},
	//订单支付api
	orderSnPay(params){
		let post_param = qs.stringify(params,{indices: false })
		return request({
			url:'/order/pay/orderno?' + post_param,
			method:'get'
		})
	},
	//获取用户活动订单未支付、等待接单、配送中
	activeOrderList(){
		return request({
			url:'/order/active/list',
			method:'get'
		})
	},
	//获取历史订单列表
	historyOrderList(){
		return request({
			url:'/order/history/list',
			method:'get'
		})
	},
	/**--------------Bd端订单相关操作api--------------**/
	//待抢单订单列表
	waitingOrderList(){
		return request ({
			url:'/dist/active/order/list',
			method:'get'
		})
	},
	//抢单
	robOrder(params){
		let post_param = qs.stringify(params,{indices: false })
		return request ({
			url:'/dist/receiv/order?' + post_param,
			method:'put'
		})
	},
	//退单
	backOrder(params){
		let post_param = qs.stringify(params,{indices: false })
		return request ({
			url:'/dist/chargeback/order?' + post_param,
			method:'put'
		})
	},
	//配送中的订单列表
	distributionOrderList(){
		return request({
			url:'/dist/distribution/order/list',
			method:'get'
		})
	},
	//已完成的订单列表
	finishOrderList(){
		return request ({
			url:'/dist/completed/order/list',
			method:'get'
		})
	},
	//确认收货
	distributionOrder(params){
		let post_param = qs.stringify(params,{indices: false })
		return request ({
			url:'/dist/complete/distribution?' + post_param,
			method:'put'
		})
	},
	//保存评价信息
	saveEvaluate(params){
		return request({
			url:'/order/rider/evaluate/save',
			method:'post',
			data:params
		})
	}
}
export default order